﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>机构管理</title>
    <!--common-->
    <link rel="stylesheet" href="/resources/src/css/lib/bootstrap.min.css">
	<link rel="stylesheet" href="/resources/src/css/admin/main.css" />
	<link rel="stylesheet" href="/resources/src/css/admin/user-manage.css" />
</head>
<body>
    <article class="main">
			<div class="main-wrapper">
				<section class="content">
				<form id="myForm" action="/admin/agency/list">
					<div class="container">
						<div class="con-body">
							<div class="toolbar clearfix">
								<!-- <div class="toolbar-left toolbar-one pull-left">
									<a href="#" id="checkout" class="pull-left">导出</a>
								</div> -->
								<div class="toolbar-right pull-left">
									<div class="input-icon">
										<input type="text" id="search" placeholder="输入机构名"/>
										<i class="iconfont icon-sousuo" id="search-btn"></i>
									</div>
								</div>
							</div>
							<div class="user-table table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>机构简称</th>
											<th>人员总数<!-- <i id="staffCount" class="iconfont icon-paixu" data-order="0"></i> --></th>
											<th>项目总数<!-- <i id="itemCount" class="iconfont icon-paixu" data-order="0"></i> --></th>
										</tr>
									</thead>
									<tbody id="mytable">
										<c:forEach items="${pages.result }" var="agency">
										<tr data-userId="255">
											<td>${agency[1] }</td>
											<td><a href="/admin/agency/${agency[0] }/agencyMember">${agency[2]}</a></td>
											<td><a href="/admin/agency/${agency[0] }/detal">${agency[3] }</a></td>
										</tr>
										</c:forEach>
										<tr>
										<td colspan="3"  style="border:0"><jsp:include page="/common/adminPage.jsp" /></td>
										</tr>
									</tbody>
								</table>		
							</div>
						</div>
					</div>
					</form>
				</section>
			</div>
		</article>
    
    <script src="/resources/src/js/jquery-1.9.1.min.js"></script>
    <script src="/resources/src/js/jquery.nicescroll.js"></script>
    <script src="/resources/src/js/moment.min.js"></script>
    <script src="/resources/src/js/daterangepicker.js"></script>
    <script src="/resources/src/js/main.js"></script>
    <script src="/resources/src/js/admin.js"></script>
    <script src="/resources/src/js/adminPage.js"></script>
    <script>
			$(function(){
				
				document.onkeydown = function(e){ 
	        	    var ev = document.all ? window.event : e;
	        	    if(ev.keyCode==13) {
	        	    	var value=$("#search").val().trim();
				 		if(value!="" && value!=null){
				 			$.ajax({
				 				type:"post",
				 				url:"/admin/agency/list",
				 				async:true,
				 				data:{"name":value},
				 				dataType:'json',
				 				success:function(data){
				 					$("#mytable").html(data);
				 				}
				 			});
				 		}
	        	     }
	        	}
				//搜索
			 	$("#search-btn").on("click",function(){
			 		var value=$("#search").val().trim();
			 		if(value!="" && value!=null){
			 			$.ajax({
			 				type:"post",
			 				url:"/admin/agency/list",
			 				async:true,
			 				data:{"name":value},
			 				dataType:'json',
			 				success:function(data){
			 					$("#mytable").html(data);
			 				}
			 			});
			 		}
			 	});
			 	
			 	//以人员总数排列,order为0时执行升序排列，为1时执行降序排列
			 	$("#staffCount").on("click",function(){
			 		var order=$(this).attr("data-order");
			 		if(order==="0"){
			 			//升序
			 			$(this).attr("data-order","1");
			 		}else{
			 			//降序
			 			$(this).attr("data-order","0");
			 		}
			 	});
			 	
			 	//以项目总数排列,order为0时执行升序排列，为1时执行降序排列
			 	$("#itemCount").on("click",function(){
			 		var order=$(this).attr("data-order");
			 		if(order==="0"){
			 			//升序
			 			$(this).attr("data-order","1");
			 		}else{
			 			//降序
			 			$(this).attr("data-order","0");
			 		}
			 	});
 	
				//分页操作，跳转到某页
			 	$("#go-page").on("click",function(){
			 		var page=$("#page").val().trim();
			 		if(page!="" && page!=null){
			 			//do something
			 		}
			 	});
			})
		</script>
    
</body>
</html>